import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from "../components/Home.vue";
import Admin from "../components/Admin.vue";
import Menu from "../components/Menu.vue";
import About from "../components/About.vue";
import News from "../components/News.vue";
import Concat from "../components/Concat.vue";

Vue.use(VueRouter)

export default new VueRouter({
  routes: [
    { path: "/", component: Home, name: "home" },
    { path: "/admin", component: Admin, name: "admin" },
    {
      path: "/menu", component: Menu, name: "menu", meta: {
        roles:['admin','user'],
        needLogin:true
      }
    },
    {
      path: "/about", component: About, name: "about", redirect: { name: "news" },
      //about的路由配置中配置子路由
      children: [
        { path: "/about/news", component: News, name: "news" },
        { path: "/concat", component: Concat, name: "concat" },
      ]
    },
    { path: "*", redirect: { name: "home" } }
  ],
  mode: "history"
})
